package com.alex.goods.entity;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

import com.alibaba.fastjson2.annotation.JSONField;

import lombok.Data;

@Data
public class Orders {
	private Integer id;
	private String orderNo;
	private String factory;
	private BigDecimal singlePrice; // to match the decimal in sql 
	private Integer num;
	private LocalDateTime datetime; // to macth the datetime in sql 
	// pirvate Date
	private String unit;
	private String personName;
	private String tel;
	private String status;
	
	
	@JSONField(format = "yyyy-MM-dd")
    private Date dateio;
	
	public String getStatus() {
		if (status != null && !"".equals(status)) {
			if (status.equals("in")) {
				return "入库";
			} else {
				return "出库";
			}
		}
		return null;
	}

	public String  getDatetime() {
	    return DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(datetime);
	}

	
//	public static void main(String[] args) {
//		OrdersService service = new OrdersServiceImpl();
//		List<Orders> list =service.selectOrdersList();
//		 System.out.println(list.size());
//		 System.out.println(list);
//		
//		 String  date=DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now());
//          System.out.println(date);
//	}
//	
//	
	
}
